package com.bizuma.template;

import java.io.FileNotFoundException;

import org.apache.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.Log4jConfigurer;

import com.bizuma.template.domain.Address;
import com.bizuma.template.domain.Person;
import com.bizuma.template.provider.PersonService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:META-INF/person-context.xml" })
public class PersonTestWithSpring {

	private static Logger logger = Logger.getLogger(PersonTestWithSpring.class);
	@Autowired
	PersonService personService;

	@Before
	public void before() throws FileNotFoundException {
//		Log4jConfigurer.initLogging("classpath:log4j.xml");
	}

	@Test
	public void registerPerson() {
		logger.debug("------------------------------");
		logger.debug("------------------------------");
		logger.debug("------------------------------");
		logger.debug("------------------------------");
		logger.debug("------------------------------");
		logger.debug("------------------------------");
		logger.debug("------------------------------");
		logger.debug("------------------------------");
		Address a1 = new Address("A Rd.", "", "Dallas", "TX", "75001");
		Person p1 = new Person("Brett", 'L', "Schuchert", a1);
		this.personService.registerPerson(p1);

	}
}
